﻿using System;
using Acme.Common.Infrastructure;

namespace Acme.MVVM.Scenarios.Model
{
    public class Person : ObservableObject, IComparable<Person>
    {

        String _firstName;
        String _lastName;
        Int32 _id;

        public String FullName
        {
            get { return String.Concat(this.FirstName, " ", this.LastName).Trim(); }
        }

        public Int32 Id
        {
            get { return _id; }
            set
            {
                _id = value;
                RaisePropertyChanged("Id");
            }
        }

        public String LastName
        {
            get { return _lastName; }
            set
            {
                _lastName = value;
                RaisePropertyChanged("LastName");
            }
        }

        public String FirstName
        {
            get { return _firstName; }
            set
            {
                _firstName = value;
                RaisePropertyChanged("FirstName");
            }
        }

        public Person()
        {
        }

        Int32 IComparable<Person>.CompareTo(Person other)
        {
            return this.FirstName.CompareTo(other.FirstName);
        }
    }
}
